package com.example.blogsystem.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截页面
 */
@Configuration
public class AppConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginIntercept())
                .addPathPatterns("/**")
                .excludePathPatterns("/CSS/**")
                .excludePathPatterns("/editor.md/**")
                .excludePathPatterns("/images/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/layui-v2.8.0/**")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/register.html")
                .excludePathPatterns("/index.html")
                .excludePathPatterns("/blogList.html")
                .excludePathPatterns("/blogDetail.html")
                .excludePathPatterns("/error.html")
                .excludePathPatterns("/art/detail")
                .excludePathPatterns("/art/updatecount")
                .excludePathPatterns("/art/add")
                .excludePathPatterns("art/listbypage")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/register");
    }
}
